import Boss1Tree from "../Tree/Boss1Tree";
import BTAction from "../../Base/BTAction";
import { NodeStatus } from "../../../common/Enum";
import { GBoss1CD } from "../../../common/Global";
import { GameLogic } from "../../../Runtime/GameLogic";

export default class ActionShoot extends BTAction {

    constructor(
        private tree: Boss1Tree
    ) {
        super()
    }
    onStart(): void {
        if (this.tree.enemy.shootCD != null && this.tree.enemy.shootCD >= GBoss1CD.shootCD) {
            this.tree.enemy.shootCD = 0
            GameLogic.Ins.addBulletByBoss(this.tree.enemy)
        }
        super.onStart()
    }

    onEnd(): void {
        super.onEnd()
    }

    onUpdate(): NodeStatus {
        return NodeStatus.Success
    }
}